package com.cswangdao.utils;

import org.apache.shiro.SecurityUtils;

public class SubjectUtil {
    public static Integer getUserId() {
        Integer userId = (Integer) SecurityUtils.getSubject().getPrincipal();
        if(userId == null){
            throw new RuntimeException("用户未登录");
        }
        return userId;
    }
}
